
// 网络请求的基础地址
export const serverUrl = "http://localhost:1337";

/**
 * 上传文件的接口地址
 */
export const uploadActionUrl = serverUrl+'/api/v1/common/upload_file'
/**
 * 处理图片
 * @param url
 * @returns
 */
export const dalImg = (url: string | undefined) => {
  if (url) {
    if (url.startsWith("http")) return url;
    return serverUrl + url;
  }
  return "https://img0.baidu.com/it/u=2254528463,283691751&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500";
};

/**
 * 设置token
 * @param token
 * @returns
 */
export const setToken = (token: string) =>
  sessionStorage.setItem("token", token);

/**
 * 获取token
 * @returns
 */
export const getToken = () => sessionStorage.getItem("token");
